/** 
 * Copyright (C), 2010-2012, AIYOU Software Co.,Ltd. ALL RIGHTS RESERVED. 
 * File name:PrivateLetterService.java
 * Version:1.0
 * Date:Dec 7, 2011
 * Description: 
 * author:whh
 */
package com.tietiao.service.privateletter;

import java.util.List;

import org.springframework.transaction.annotation.Transactional;

import com.tietiao.dao.model.PrivateLetter;
import com.tietiao.dao.model.SysUser;

/**
 * 私信
 */
public interface PrivateLetterService {
	/**
	 * 
	 * 功能：发送私信
	 * 
	 * @author: whh
	 * @Date:2011-12-07
	 * 
	 * @return 私信是否添加成功 0：为失败 1:成功
	 */
	public int insertPrivateLetter(PrivateLetter letter);

	/**
	 * 功能：更新私信信息(接收者已读)
	 * 
	 * @author: whh
	 * @Date: 2011-12-07
	 * 
	 * @return 是否更新成功
	 */
	public int updateToRead(int letterId);

	/**
	 * 
	 * 功能：将信设置为删除(两人都删除，且无关联私信，则真实删除)
	 * 
	 * @author: whh
	 * @Date: Dec 7, 2011
	 * 
	 * @param id
	 *            私信ID号
	 * @return
	 */
	@Transactional
	public int deletePrivateLetter(int id, SysUser user);

	/**
	 * 
	 * 功能：通过id号加载用户信息（接收者第一次通过Id加载为已读）
	 * 
	 * @author: whh
	 * @Date: 2011-12-06
	 * 
	 * @return 返回用户信息
	 */
	public PrivateLetter loadPrivateLetterId(int id);

	/**
	 * 
	 * 功能：加载私信列表信息
	 * 
	 * @author: zhijian.zhang
	 * @Date: 2011-12-25
	 * 
	 * @param userId
	 *            用户ID
	 * @return
	 */
	public List<PrivateLetter> loadPrivateLetters(int userId);

	/**
	 * 
	 * 功能：发送私信列表
	 * 
	 * @author: zhijian.zhang
	 * @Date: 2011-12-25
	 * 
	 * @param sendUserId
	 * @param receiveUserId
	 * @param content
	 * @return
	 */
	@Transactional
	public PrivateLetter sendPrivateLetter(int sendUserId, int receiveUserId,
			String content);

	/**
	 * 
	 * 功能：根据当前登录用户ID和关注用户ID获取私信详细信息列表
	 * 
	 * @author: zhijian.zhang
	 * @Date: 2011-12-26
	 * 
	 * @param loginUserId
	 * @param friendUserId
	 * @return
	 */
	public List<PrivateLetter> loadPrivateLetterDetails(int loginUserId,
			int friendUserId);

	/**
	 * 
	 * 功能：获取未查看私信数量
	 * 
	 * @author: zhijian.zhang
	 * @Date: 2011-12-26
	 * 
	 * @param loginUserId
	 * @return
	 */
	public int getNoViewCounts(int loginUserId);

	/**
	 * 
	 * 功能：根据当前用户ID和好友ID删除私信
	 * 
	 * @author: zhijian.zhang
	 * @Date: 2011-12-29
	 * 
	 * @param loginUserId
	 * @param friendUserId
	 * @return
	 */
	@Transactional
	public int deletePrivateLetters(int loginUserId, int friendUserId);
}
